package com.nextwist.interfaces;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.apache.cxf.jaxrs.ext.multipart.Attachment;

import com.nexttwist.pojo.Flag;
import com.nexttwist.pojo.Line;
import com.nexttwist.pojo.Story;
import com.nexttwist.pojo.Vote;

@Path("/story")
public interface IStoryInterface {
	
	@POST
	@Path("addStory")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	@Consumes({MediaType.APPLICATION_JSON})
	public Response addStory(Story storyObject);
	
	@PUT
	@Path("updateStory")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	@Consumes({MediaType.APPLICATION_JSON})
	public Response updateStory(Story storyObject);
	
	@DELETE
	@Path("deleteStory")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	public Response deleteStory(@QueryParam("storyId") int storyId);
	
	@GET
	@Path("getEntryLines")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	public Response getEntryLine(@QueryParam("storyId") int storyId, @QueryParam("storyLineId") int storyLineId, @QueryParam("userId") int userId);
	
	@GET
	@Path("getStoryLines")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	public Response getStoryLine(@QueryParam("storyId") int storyId);

	@POST
	@Path("addLine")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	@Consumes({MediaType.APPLICATION_JSON})
	public Response addLine(Line lineObject);
	
	@DELETE
	@Path("deleteLine")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	public Response deleteLine(@QueryParam("storyId") int storyId, @QueryParam("uniqueId") int uniqueId);

	@POST
	@Path("addFlag")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	@Consumes({MediaType.APPLICATION_JSON})
	public Response addFlag(Flag flagObject);
	
	@POST
	@Path("giveVote")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	@Consumes({MediaType.APPLICATION_JSON})
	public Response giveVote(Vote voteObj);
	
	@GET
	@Path("searchStory")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	public Response searchStory(@QueryParam("searchLine") String searchLine);
	
	@POST
	@Path("addSong")
	@Produces({MediaType.APPLICATION_JSON})
	@Consumes({MediaType.MULTIPART_FORM_DATA})
	public Response addSong(@QueryParam("userId") int userId, @QueryParam("title") String title, Attachment attachment);
	
	@POST
	@Path("addSongLine")
	@Produces({MediaType.APPLICATION_JSON})
	@Consumes({MediaType.MULTIPART_FORM_DATA})
	public Response addSongLine(@QueryParam("userId") int userId, @QueryParam("storyId") int storyId, Attachment attachment);
	
	
	@GET
	@Path("getHotStories")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	public Response getHotStories();

	@GET
	@Path("getFreshStories")
	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	public Response getFreshStories();

}
